# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Dumitru Ursu <dima@ceata.org>

pkgname=opencolorio
pkgver=2.2.1
pkgrel=7
pkgdesc="A color management framework for visual effects and animation"
arch=('x86_64')
url="https://opencolorio.org"
license=('BSD')
depends=('freeglut' 'glew' 'lcms2' 'tinyxml' 'yaml-cpp' 'imath' 'pystring' 'minizip-ng' 'openexr')
makedepends=('cmake' 'python' 'pybind11' 'ninja')
checkdepends=('openimageio')
optdepends=('python: python bindings')
source=($pkgname-$pkgver.tar.gz::https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v$pkgver.tar.gz)
sha512sums=('d5f3a4b5bd661af7336c015d07e0feccb286464a08239a3c259a97217001161e7571f5137475fc2f4d1b9af6381bbfa03c0b60f41de282f114307961b8d84fc9')

build() {
  cd OpenColorIO-$pkgver

  CXXFLAGS+=" -ffat-lto-objects"
  cmake \
    -GNinja \
    -Bbuild \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_SKIP_INSTALL_RPATH=YES \
    -Wno-dev
  ninja -C build
}

check() {
  cd OpenColorIO-$pkgver/build

  ctest -E test_gpu
}

package() {
  cd OpenColorIO-$pkgver

  DESTDIR="$pkgdir" ninja -C build install
  install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
